﻿namespace idea.entity
{
    using System;
    using System.Data;
    using System.Configuration;

    /// <summary>
    /// sequence 的摘要说明
    /// </summary>
    /// 

    public class sequence 
    {
        private  p_sequence p;
        private  int m_seqID;
        public sequence(int seqID)
	    {
		    //
		    // TODO: 在此处添加构造函数逻辑
		    //
            m_seqID = seqID;
            p = new p_sequence();
	    }
        private long getSequence()
        {
            p.seqID = m_seqID;
            if(p.initByseqID())
                return p.sequenceNo;
            else
                throw(new Exception(string.Format("无法从p_seqquence获取seqID={0}的序列值",m_seqID)));

        }
        public long getNumberSequence()
        {
            long n;
            n = getSequence();
            return n;
        }
        public string getStringSequence()
        {
            long n;
            n = getSequence();

            return string.Format("{0:D5}", n); ;
        }
        public void UpdateSequence()
        {
            p.sequenceNo += 1;
            p.update();
        }
    }
}